#include <iostream>
#include <cstring>
using namespace std;
using ll=long long;

const int N=2*1e5+10;

ll a[N];
ll tr[N];
ll heigher[N];
ll lower[N];
int n;
int lowbit(int x)
{
	return x&(-x);
}
void add(int x,int c)
{
	for(int i=x;i<=n;i+=lowbit(i))
	{
		tr[i]+=c;
	}
}
ll sum(int x)
{
	ll ret=0;
	for(int i=x;i>0;i-=lowbit(i))
	{
		ret+=tr[i];
	}
	return ret;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	
	
	for(int i=1;i<=n;i++)
	{
		int y=a[i];
		heigher[i]=sum(n)-sum(y);
		lower[i]=sum(y-1);
		add(y,1);
	}
	memset(tr,0,sizeof(tr));
	ll ret1=0,ret2=0;
	for(int i=n;i>=1;i--)
	{
		int y=a[i];
		ret1+=heigher[i]*(sum(n)-sum(y));
		ret2+=lower[i]*sum(y-1);
		add(y,1);
	}
	cout<<ret1<<" "<<ret2<<endl;
	return 0;
}
